#ifndef BYTE_TIEMPO_H_INCLUDED
#define BYTE_TIEMPO_H_INCLUDED

#include <string>
#include <iostream>
#include <sstream>

    //Time se mide en SEGUNDOS !
class Byte_Tiempo{
    public:
    int Time;
    int Byte;

    Byte_Tiempo(int Ti,int B):Time(Ti),Byte(B){}
    ~Byte_Tiempo(){}

    Byte_Tiempo(const std::string& str)
    {
        this->Hidratar(str);
    }


    std::string to_string()const
    {
        std::stringstream ssa;
        std::string str1;
        std::string str2;
        ssa <<  this->Time;
        ssa >> str1 ;
        ssa.clear();
        ssa << this->Byte;
        ssa >> str2 ;
        std::string TEXT = "(" + str1 + "," + str2 +")" ;
        return TEXT;
    }

    std::string Serializar()
    {
        std::stringstream ssa;
        std::string str1;
        std::string str2;
        ssa <<  this->Time;
        ssa >> str1 ;
        ssa.clear();
        ssa << this->Byte;
        ssa >> str2 ;
        std::string TEXT = str1 + " " + str2 + "@" ;
        return TEXT;
    }

    void Hidratar(const std::string& str)
    {
        std::stringstream conversor;
        std::string aux_aconvertir;
        std::stringstream ssa(str);
        ssa >>aux_aconvertir;
        conversor << aux_aconvertir;
        conversor >> this->Time;
        ssa.ignore(1);
        conversor.clear();
        ssa >> aux_aconvertir;
        conversor << aux_aconvertir;
        conversor >> this->Byte;
    }

};
#endif // BYTE_TIEMPO_H_INCLUDED
